#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Time       :   21:05
# Author     : Y4
# Site       : 
# File       : 008 线程的全局变量.py
# Software   : PyCharm

import threading
from time import sleep

n = 1000

def run1():
    global  n
    for i in range(100):
        n -= 1

if __name__ == '__main__':
    t = threading.Thread(target=run1)
    t1 = threading.Thread(target=run1)
    t2 = threading.Thread(target=run1)
    t3 = threading.Thread(target=run1)
    t.start()
    t1.start()
    t2.start()
    t3.start()
    t.join()
    t1.join()
    t2.join()
    t3.join()

    print(n)                # 600